package com.czxy.dao;

import cn.itcast.xml.XmlUtils;
import com.czxy.domain.User;
import org.junit.Test;


import java.util.ArrayList;
import java.util.List;

public class UserDao {
    public static  final String xmlPath = "F:\\day20210930\\users.xml";

    // 查询所有
    public List<User> findAll(){
        return  XmlUtils.readAll(xmlPath,User.class);
    }



    @Test
    public void initData(){
        List<User> list = new ArrayList<User>();
        list.add(new User("u001", "zhangsan", "123"));
        list.add(new User("u002", "lisi", "456"));
        XmlUtils.write(xmlPath, list);
    }
}
